#include "ObjectAllPubSubTypes.h"
#include "FaultInfo_tPubSubTypes.h"
#include "AlarmInfo_tPubSubTypes.h"
#include "default_participant.h"
#include "default_publisher.h"
//#include "sensor_msgs/msgs/Mocap.h"
#include <chrono>
#include <cstdlib>
#include <future>

int main() {
  // Message
  vis_msg::ObjectAll obj;
  obj.id(1);
  obj.name("hello hi!!!");

  obj.alarmInfo().m_ATP_COMMUNICATION_TIMEOUT_ALARM_INFO() = false;
  //obj.alarmInfo().m_ATP_COMMUNICATION_TIMEOUT_ALARM_INFO(false);
Object_t objs;






obj.objects().push_back(objs);
  // FaultInfo_t faultInfo_t;
  // AlarmInfo_t alarmInfo_t;

  // alarmInfo_t.m_ATP_COMMUNICATION_TIMEOUT_ALARM_INFO() = false;
  // faultInfo_t.m_AODS_SOFTWARE_FATAL_ERROR_FAULT_INFO() = true;
  
  // obj.alarmInfo() = alarmInfo_t;
  // obj.faultInfo() = faultInfo_t ;

  // Create participant. Arguments-> Domain id, QOS name
  DefaultParticipant dp(0, "hi");

  // Create publisher with msg type
  DDSPublisher hello_pub(vis_msg::ObjectAllPubSubType(), "obj",dp.participant());

  // Initialize publisher with topic name
  if (hello_pub.init()) {
    for (int i = 0; i < 10; i++) {
      obj.id(i + 1);
      //h264Stream.channelNumber(i + 1);

      hello_pub.publish(obj);
      std::this_thread::sleep_for(std::chrono::milliseconds(1));
    }
  }

  // eprosima::fastdds::dds::DomainParticipantFactory::get_instance()
  //     ->delete_participant(participant_);
}
